#include<stdio.h>
#include<math.h>
int su(int x){
	int c,a;
    a=x;
	double b;
	b=sqrt (x);
	for (c=2;c<=b;c++){
		if(a%c==0){
			break;
		}
	}
	if(c>b)
		a=1;
	else
		a=0;
	if(x<=1)
		a=0;
	return a;
}
int GXH (int x){
	int a,sum=0;
	for(;x!=0;){
		a=x%10;
		x/=10;
		sum+=a;
	}
	return sum;
}
int PFH(int x){
	int a,sum=0;
	for(;x!=0;){
		a=x%10;
		x/=10;
		sum+=a*a;
	}
	return sum;
}
int main (){
	int a,b,sum=0;
	printf("请输入区间起始点\n");
	scanf ("%d",&a);
	printf("请输入区间终止点\n");
	scanf ("%d",&b);
	for(;a<=b;a++)
	if (su(a)==1&&su(GXH(a))==1&&su(PFH(a))==1){
		sum++;
	}
	printf("共%d个超级素数",sum);
	return 0;	 
}